
/**
 *  Class: Datastructures, CSI 326 Fall 2011
 *  Members: Christopher Nerf, Greg Shevach, Mesfin Solomon, Vidat Muslim
 *  Project: Project 1
 *  Scope: Implement a stack using one of the basic containers we have or will discuss. Example: A vector or list based stack.
 *  	   Implement a queue using one of the basic containers we have or will discuss. Example: A circular array or list based
 *		   queue
 *		   Develop and implement a palindrome checker that uses your stack and/or queue.
 *				 The data to be checked as a palindrome will consist of string characters, possibly containing whitespace and
 *				punctuation.
 *				 A palindrome reads the same forward as backward, ignoring case, whitespace and punctuation.
 *				 The strings to check will be stored in a file, one string per line. The file will contain the string quit to signify
 *				the end of file.
 *				 The strings can be of any length
 *  Version: 0.0 - Initial Pass
 */



/**
 * DoubleNode represents a node in a doubly linked list.
 * This code is unaltered provided by the professor
 */

public class DoubleNode<T> {
    private T element;
    private DoubleNode<T> next;
    private DoubleNode<T> previous;

    /**
     * Creates an empty node.
     */
    public DoubleNode() {
       element  = null;
       next     = null;
       previous = null;
    }

    /**
     * Creates a node storing the specified element.
     */
    public DoubleNode( T elem ) {
       element  = elem;
       next     = null;
       previous = null;
    }

   /**
     * Returns the node that follows this one.
     */
    public DoubleNode<T> getNext() {
       return next;
    }

    /**
     * Returns the node that precedes this one.
     */
    public DoubleNode<T> getPrevious() {
	return ( previous );
    }

    /**
     * Sets the node that follows this one.
     */
    public void setNext( DoubleNode<T> n ) {
       next = n;
    }

    /**
     * Sets the node that precedes this one.
     */
    public void setPrevious( DoubleNode<T> n ) {
       previous = n;
    }

    /**
     * Returns the element stored in this node.
     */
    public T getElement() {
	return ( element );
    }

    /**
     * Sets the element stored in this node.
     */
    public void setElement( T elem ) {
       element = elem;
    }

    /**
     * Sets the element stored in this node.
     */
    public String toString() {
	return ( element.toString() );
    }
}